home *** CD-ROM | disk | FTP | other *** search
- Program IconTest;
-
- { This simple program demonstrates the use of TIcons }
-
- Uses
- App,
- CRT,
- Icon,
- Objects,
- Views;
-
- Type
- MyApp = Object (TApplication)
- Constructor Init;
- end;
-
- { override the DoubleCLick method to demonstrate its use. }
- { this example just beeps when the icon is double-clicked }
-
- PTestIcon = ^TTestIcon;
- TTestIcon = Object (TIcon)
- Procedure DoubleClick;
- virtual;
- end;
-
- Procedure TTestIcon.DoubleClick;
- begin
- Sound(5000);
- delay(50);
- NoSound;
- end;
-
-
- Constructor MyApp.Init;
- Var
- R : TRect;
- i : integer;
- begin
- Inherited Init;
- { insert some icons into the *Application* in random locations }
-
- for i := 1 to 5 do
- begin
- R.Assign(1,1,9,2);
- R.Move(Random(70),Random(20));
- Insert(New(PTestIcon,Init(R,'~Icon~ ' + char(i+$30))));
- end;
-
- { put some normal windows on the Desktop to show how they interact
- with icons }
-
- R.Assign(5,5,35,12);
- InsertWindow(New(PWindow,Init(R,'Normal Window',1)));
- R.Move(1,1);
- InsertWindow(New(PWindow,Init(R,'Normal Window',2)));
- end;
-
- Var
- TestApp : MyApp;
-
- BEGIN
- TestApp.Init;
- TestApp.Run;
- TestApp.Done;
- END.